// import count from '@dfeidao/atom-nodejs/db/count';
import operate from '@dfeidao/atom-nodejs/db/operate';
import log from '@dfeidao/atom-nodejs/logger/log';
interface Message {
	productid: string;
	level_no: string;
	usercode: string;
	username: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log(`Service begin`);
	// const { prepare, exec } = count(action_id, session_id, '12');
	const { del, exec: e } = operate(action_id, session_id, '12');

	del('tenant_level', { productid: msg.productid, level_no: msg.level_no });
	del('tenant_level_form', { productid: msg.productid, level_no: msg.level_no });
	del('tenant_level_form_code', { productid: msg.productid, level_no: msg.level_no });
	const ret = await e();
	if (ret.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
